﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Logging;

namespace WebApp.Services
{
    public class EfMySqlContextService : DbContext, IDataBaseService
    {
        private readonly DbConnectionConfigurationServicecs _dbConfig;
        private readonly ILogger<EfMySqlContextService> _logger;


        public EfMySqlContextService(DbConnectionConfigurationServicecs dbConfig, ILogger<EfMySqlContextService> logger)
        {
            _dbConfig = dbConfig;
            _logger = logger;
        }
        public DbSet<TestModel> TestModels { set; get; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
            => optionsBuilder.UseMySql(_dbConfig.DbConnection.MySql);
                //.EnableSensitiveDataLogging()
                //.UseLoggerFactory();

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {

        }

    }



}
